package com.geovis.emergency.spd.controller.basic;


import com.geovis.common.core.api.Result;
import com.geovis.common.core.constant.SwaggerConstants;
import com.geovis.common.core.controller.BaseController;
import com.geovis.emergency.spd.biz.basic.service.IBasicKpiService;
import com.geovis.emergency.spd.entity.basic.entity.BasicKpi;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 基础模块-考核指标 前端控制器
 * </p>
*
* @author Lonsho
* @since 2022-07-26
*/
@RestController
@RequestMapping("/basic/kpi")
@RequiredArgsConstructor
@Api(value = "基础模块-考核指标接口", tags = "基础模块-考核指标接口")
@Slf4j
@Validated
public class BasicKpiController extends BaseController<IBasicKpiService> {

    @ApiOperationSupport(order = 1)
    @ApiOperation(value = SwaggerConstants.SAVE_VALUE, notes = SwaggerConstants.SAVE_VALUE)
    @PostMapping({"/save"})
    public Result save(@RequestBody BasicKpi basicKpi){
        baseService.save(basicKpi);
        return Result.ok();
    }
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = SwaggerConstants.UPDATE_VALUE, notes = SwaggerConstants.UPDATE_NOTES)
    @PostMapping({"/update"})
    public Result update(@RequestBody BasicKpi basicKpi){
        baseService.updateById(basicKpi);
        return Result.ok();
    }

}
